/*
 * Copyright (c) 2009 by Vsevolod Velichko <torkvemada@nigma.ru>
 *
 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************
*/

#ifndef INDIGO_H
#define INDIGO_H 1

#define PHP_INDIGO_VERSION (char*)"1.4"
#define PHP_INDIGO_EXTNAME (char*)"indigo"

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */

#ifdef HAVE_DINGO
#define PHP_DINGO_CLASS_NAME "Dingo"
#include <vector>
#endif /* HAVE_DINGO */

#ifdef HAVE_CANO
#define PHP_CANO_CLASS_NAME "Cano"
#endif /* HAVE_CANO */

#ifdef __cplusplus
extern "C"
{
#endif
#include "php.h"
#include "ext/standard/info.h"

#ifdef HAVE_DINGO
#include "dingo_c.h"
#endif /* HAVE_DINGO */
#ifdef HAVE_CANO
#include "cano.h"
#endif /* HAVE_CANO */

#ifdef __cplusplus
}
#endif

PHP_MINIT_FUNCTION(indigo);
PHP_MSHUTDOWN_FUNCTION(indigo);
PHP_MINFO_FUNCTION(indigo);

#ifdef HAVE_DINGO
PHP_METHOD(PHP_DINGO_CLASS_NAME, __construct);
PHP_METHOD(PHP_DINGO_CLASS_NAME, __destruct);
PHP_METHOD(PHP_DINGO_CLASS_NAME, __toString);
PHP_METHOD(PHP_DINGO_CLASS_NAME, reset);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setLogPath);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setLoadHighlighting);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setInputFormat);
PHP_METHOD(PHP_DINGO_CLASS_NAME, loadMolFromFile);
PHP_METHOD(PHP_DINGO_CLASS_NAME, loadMolFromString);
PHP_METHOD(PHP_DINGO_CLASS_NAME, loadReactionFromFile);
PHP_METHOD(PHP_DINGO_CLASS_NAME, loadReactionFromString);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setOutputFormat);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setOutputFile);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setImageSize);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setBondLength);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setMarginFactor);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setRelativeThickness);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setBaseColor);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setBackgroundColor);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setImplicitHydrogenMode);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setColoring);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setValencesVisible);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setAtomIdsVisible);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setBondIdsVisible);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setStereoOldStyle);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setLabelMode);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setAromatization);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setHighlightThicknessEnabled);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setHighlightColor);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setAAMColor);
PHP_METHOD(PHP_DINGO_CLASS_NAME, setCenterDoubleBondWhenStereoAdjacent);
PHP_METHOD(PHP_DINGO_CLASS_NAME, render);
PHP_METHOD(PHP_DINGO_CLASS_NAME, getRenderedString);

#define GET_ID(id) \
	zval *___objptr = getThis(); \
	zval *___zid = zend_read_property(Z_OBJCE_P(___objptr), ___objptr, (char*)"ID", 2, 1 TSRMLS_CC); \
	long id = ___zid->value.lval
#endif /* HAVE_DINGO */

#ifdef HAVE_CANO
PHP_METHOD(PHP_CANO_CLASS_NAME, getVersion);
PHP_METHOD(PHP_CANO_CLASS_NAME, getCanonicalSmiles);
PHP_METHOD(PHP_CANO_CLASS_NAME, getInChI);
#endif /* HAVE_CANO */

extern zend_module_entry indigo_module_entry;

#endif /* INDIGO_H */
